#pragma once

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>

/*****定义结构体*****/
struct cstnode
{
    char data;
    struct cstnode *leftmostchild, *rightsibling;
};
typedef struct cstnode cstnode;
typedef struct cstnode *cstree;
/*****定义结构体*****/

/***打印树***/
void print_t(cstree t)
{
    if (t != nullptr)
    {
        printf("当前结点为%c   ", t->data);
        if (t->leftmostchild != nullptr)
        {
            printf("最左孩子结点为%c    ", t->leftmostchild->data);
        }
        else
        {
            printf("最左孩子结点为空   ");
        }
        if (t->rightsibling != nullptr)
        {
            printf("  右兄弟结点为%c\n", t->rightsibling->data);
        }
        else
        {
            printf("  右兄弟结点为空\n");
        }
        if (t->leftmostchild != nullptr)
        {
            print_t(t->leftmostchild);
        }
        if (t->rightsibling != nullptr)
        {
            print_t(t->rightsibling);
        }
    }
    else
    {
        printf("此树为空\n");
    }
}
/***打印树***/

/*****声明二叉树结点*****/
cstree t0, t1, t2, t3, t4, t5, t6, t7, t8, t9,t10;
/*****声明二叉树结点*****/

/*****初始化结点*****/
void t_init()
{
    t0 = nullptr;
    t1->data = '1';
    t2->data = '2';
    t3->data = '3';
    t4->data = '4';
    t5->data = '5';
    t6->data = '1';
    t7->data = '2';
    t8->data = '3';
    t9->data = '4';
    t10->data = '5';
    t1->leftmostchild = nullptr;
    t1->rightsibling = nullptr;
    t2->leftmostchild = nullptr;
    t2->rightsibling = nullptr;
    t3->leftmostchild = nullptr;
    t3->rightsibling = nullptr;
    t4->leftmostchild = nullptr;
    t4->rightsibling = nullptr;
    t5->leftmostchild = nullptr;
    t5->rightsibling = nullptr;
    t6->leftmostchild = nullptr;
    t6->rightsibling = nullptr;
    t7->leftmostchild = nullptr;
    t7->rightsibling = nullptr;
    t8->leftmostchild = nullptr;
    t8->rightsibling = nullptr;
    t9->leftmostchild = nullptr;
    t9->rightsibling = nullptr;
    t10->leftmostchild = nullptr;
    t10->rightsibling = nullptr;
}
/*****初始化结点*****/